﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/QuizAdmin.Master" AutoEventWireup="true" CodeBehind="DefineQuiz.aspx.cs" Inherits="BladeTecWebApplication.Admin.DefineQuiz" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

<script type="text/javascript">
$(function () {
	$('#tabs').tabs();
	$('#tabs1').tabs();

	$('#errorDialog').dialog({
		autoOpen: false,
		width: 400,
		modal: true,
		buttons: {
			"Ok": function () {
				$(this).dialog("close");
			}
		}
	});

	$("#MainContent_ddlCategory").change(toggle);
	$("#MainContent_ddlLevel").change(toggle);

});

function toggleQuestionDiv(selected, questionId) {
	if (selected) {
		$("#questionTable" + questionId).toggleClass('questionTableSelected', true);
	} else {
		$("#questionTable" + questionId).toggleClass('questionTableSelected', false);
	}
}

function validatePage() {
	var title = $("#MainContent_txtQuizTitle").val();
	if (title == '') {
		$('#errorDialog').dialog('open');
		return false;
	}
}

function toggle() {
	var categoryId = $("#MainContent_ddlCategory").val();
	var levelId = $("#MainContent_ddlLevel").val();
	$("div[divtype=questionDiv]").show();
	if (categoryId != '-1') {
		$("div[divtype=questionDiv][category!=" + categoryId + "]").hide();
	}
	if (levelId != '-1') {
		$("div[divtype=questionDiv][level!=" + levelId + "]").hide();
	}
}

</script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<span class="pageTitle">Define Quiz</span>
<br /><br />

<asp:Panel ID="pnlQuizSettings" runat="server">

	<div id="tabs" style="width: 600px;">
		<ul>
			<li><a href="#tabs-1">Quiz Information</a></li>
		</ul>
		<div id="tabs-1">
			<table cellpadding="0" cellspacing="0" border="0">
				<tr>
					<td>Quiz Title:<asp:RequiredFieldValidator runat="server" ErrorMessage="*" ForeColor="Red" ControlToValidate="txtQuizTitle"></asp:RequiredFieldValidator></td>
					<td style="width: 10px;">&nbsp;</td>
					<td><asp:TextBox ID="txtQuizTitle" runat="server" Width="350px" CssClass="stdTextBox" ClientIDMode="Predictable"></asp:TextBox></td>
				</tr>
			</table>
		</div>
	</div>

	<br />
	<br />

	<div id="tabs1">
		<ul>
			<li><a href="#tabs-2">Question Bank</a></li>
		</ul>
		<div id="tabs-2" style="width:1000px;">
			The list below shows all of the available questions that can be added to the quiz. The list can be filtered by category or by question level.
			<br /><br />
			<table cellpadding="0" border="0" cellspacing="0">
				<tr>
					<td>Filter Answers by Category:</td>
					<td style="padding-left: 10px;"><asp:DropDownList ID="ddlCategory" ClientIDMode="Predictable" runat="server"></asp:DropDownList></td>

					<td style="padding-left: 20px;">Filter Answers by Level:</td>
					<td style="padding-left: 10px;"><asp:DropDownList ID="ddlLevel" ClientIDMode="Predictable" runat="server"></asp:DropDownList></td>
				</tr>
			</table>

			<br />
			<table class="netsysTable" cellspacing="0" rules="all" id="MainContent_gvApplicants" style="border-width:0px;border-style:None;width:100%;border-collapse:collapse; margin-bottom:5px;">
				<tr>
					<th style="width:5px; text-align:left;">&nbsp;</th>
					<th style="width:700px; text-align:left;">Question</th>
					<th style="width:100px; text-align:left;">Level</th>
					<th style="width:200px; text-align:left;">Category</th>
				</tr>
			</table>
			<asp:Panel ID="pnlQuestions" runat="server">
			</asp:Panel>

		</div>
	</div>

	<br />

	<div style="text-align:right;">
		<asp:Button ID="btnAddQuiz" runat="server" Text="Add Quiz" 
			onclick="btnAddQuiz_Click" OnClientClick="validatePage();" />
	</div>

</asp:Panel>

<asp:Panel Visible="false" ID="pnlResult" runat="server">
	Quiz <asp:Label Font-Bold="true" ID="quizName" runat="server"></asp:Label> was added.
	<br /><br />
	<a class="dashboardLink" href="ViewQuizzes.aspx">View Quizzes</a>
</asp:Panel>

<div id="errorDialog" title="No Quiz Title">
	Please enter a quiz title.
</div>

</asp:Content>
